Skip to content

Add DataDome bot protection integration#231

Open
ChristianPavilonis wants to merge 5 commits intomainfrom
feature/datadome-integration-christian
Open

Add DataDome bot protection integration#231
ChristianPavilonis wants to merge 5 commits intomainfrom
feature/datadome-integration-christian

Conversation

@ChristianPavilonis
Copy link
Collaborator

@ChristianPavilonis ChristianPavilonis commented Feb 3, 2026

Summary

Adds DataDome bot protection integration for first-party delivery of the DataDome JavaScript SDK and signal collection API. This enables publishers to use DataDome without DNS/CNAME configuration.

Closes #61

Changes

Rust (crates/common/src/integrations/datadome.rs)

  • Proxy endpoints: GET /integrations/datadome/tags.js and GET/POST /integrations/datadome/js/*
  • Script content rewriting using static Lazy<Regex> to replace DataDome URLs with first-party paths
  • HTML attribute rewriting for src and href attributes via IntegrationAttributeRewriter

TypeScript (crates/js/lib/src/integrations/datadome/)

  • Client-side script guard using shared createScriptGuard factory
  • Intercepts dynamically inserted <script> and <link rel="preload|prefetch"> elements
  • Preserves original DataDome paths in rewritten URLs

Shared Script Guard Enhancement (crates/js/lib/src/shared/script_guard.ts)

  • Added rewriteUrl callback option for custom URL rewriting (in addition to existing proxyPath)
  • Added includePrefetch option to handle rel="prefetch" links

Documentation

  • New guide: docs/guide/integrations/datadome.md
  • Comprehensive module-level rustdoc

Configuration

[integrations.datadome]
enabled = true
sdk_origin = "https://js.datadome.co"
api_origin = "https://api-js.datadome.co"
cache_ttl_seconds = 3600
rewrite_sdk = true

Testing Plan

Verify on the test site:

  • SDK script proxied via /integrations/datadome/tags.js
  • Script content rewritten (DataDome URLs replaced with first-party paths)
  • Signal collection API calls proxied via /integrations/datadome/js/*
  • HTML attribute rewriting works for <script src> tags
  • Automated browsers (Playwright, Puppeteer, Chrome MCP) are detected and blocked by DataDome.

@ChristianPavilonis ChristianPavilonis force-pushed the feature/datadome-integration-christian branch from 26a3699 to d5f40db Compare February 3, 2026 23:20
@ChristianPavilonis ChristianPavilonis marked this pull request as ready for review February 3, 2026 23:31
@ChristianPavilonis ChristianPavilonis force-pushed the feature/datadome-integration-christian branch from a9f1552 to c6f1536 Compare February 4, 2026 21:28
@ChristianPavilonis ChristianPavilonis force-pushed the feature/datadome-integration-christian branch from c6f1536 to 2143b2b Compare February 4, 2026 21:55
@ChristianPavilonis ChristianPavilonis force-pushed the feature/datadome-integration-christian branch from 5ac0c09 to 504bc52 Compare February 5, 2026 17:52
@ChristianPavilonis ChristianPavilonis force-pushed the feature/datadome-integration-christian branch from 504bc52 to 579c282 Compare February 5, 2026 17:59
@aram356 aram356 requested a review from prk-Jr February 5, 2026 20:19
Copy link
Collaborator

@aram356 aram356 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Look good. Thank you for making the updates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

As publisher I would to use Datadome settings with Trusted Server #15

3 participants